<?php

namespace apiend\controllers;

use Yii;
use apiend\components\Controller;
use common\models\base\BaseDistrict;

/**
 * 全局应用接口
 * 
 * @author emhome <emhome@163.com>
 * @since 1.0
 */
class AddressController extends Controller {

    /**
     * @inheritdoc
     */
    public $filterAccessToken = false;

    /**
     * Declares the allowed HTTP verbs.
     * Please refer to [[VerbFilter::actions]] on how to declare the allowed verbs.
     * @return array the allowed HTTP verbs.
     */
    protected function verbs() {
        return [
            '*' => ['GET'],
        ];
    }

    /**
     * @inheritdoc
     */
    protected function rules() {
        return [
            [
                'allow' => true,
            ],
        ];
    }

    /**
     * 获取H5前端路由地址别名
     * @return mixed
     */
    public function actionArea() {
        return BaseDistrict::loadDist();
    }

    /**
     * 获取H5前端路由地址别名
     * @return mixed
     */
    public function actionTree() {
        return BaseDistrict::loadTree();
    }

    /**
     * 获取H5前端路由地址别名
     * @return mixed
     */
    public function actionRegion() {
        return BaseDistrict::loadRegion();
    }

    /**
     * 获取H5前端路由地址别名
     * @return mixed
     */
    public function actionRegions() {
        return BaseDistrict::loadRegionList();
    }

}
